package ce.com.cenewbluesdk.entity.k3;

import android.os.Parcel;
import android.os.Parcelable;

import ce.com.cenewbluesdk.CEBC;
import ce.com.cenewbluesdk.entity.BaseData;
import ce.com.cenewbluesdk.entity.CEDevData;

/**
 * Created by Administrator on 2015/11/28 0028.
 */
public class Send_Watch_Face_And_Notification_Set_K3 extends BaseData implements Parcelable {
    public static final int  dateRealySize=9;
    public Send_Watch_Face_And_Notification_Set_K3(byte[] send_byte) {
        this.send_byte = send_byte;
    }
    private byte[] send_byte;

    protected Send_Watch_Face_And_Notification_Set_K3(Parcel in) {
        send_byte = in.createByteArray();
    }

    public static final Creator<Send_Watch_Face_And_Notification_Set_K3> CREATOR = new Creator<Send_Watch_Face_And_Notification_Set_K3>() {
        @Override
        public Send_Watch_Face_And_Notification_Set_K3 createFromParcel(Parcel in) {
            return new Send_Watch_Face_And_Notification_Set_K3(in);
        }

        @Override
        public Send_Watch_Face_And_Notification_Set_K3[] newArray(int size) {
            return new Send_Watch_Face_And_Notification_Set_K3[size];
        }
    };

    public byte[] getBytes() {

//        return new byte[]{(byte) 0xff,0, (byte) 0xff,0};

        byte[] send=new byte[16];
        System.arraycopy(send_byte,0,send,0,send_byte.length);
        return send;
    }

    public static int getItemSize() {
        return 16;
    }

    /**
     * 现在有效数据的实际长度
     * @return
     */
    public static int getRealySize(){
        return dateRealySize;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeByteArray(send_byte);
    }

    @Override
    public CEDevData toCEDevData() {
        CEDevData data=new CEDevData(CEBC.CMD_SEND_TYPE,CEBC.K3.DATA_TYPE_WATCHFACE_MENU_SELECT);
        data.setItemL(getItemSize());
        data.setItemNumber(1);
        data.setData(getBytes());
        return data;
    }
}
